<?php
class Controller_App_Sign extends Controller_App_Template
{
    public function __construct ($req, $res)
    {
        $this->template = "smarty:app/service/blank";
        parent::__construct($req, $res);
    }

    public function action_index ()
    {
        $uid = $this->_uid;
        // 获取该用户总共签到了多少次
        $total_count = App_Sign::get_total_sign_num($uid);
        // 获取该用户连续签到了多少次
        $continuity_count = App_Sign::get_continuity_sign_num($uid);
        // 获取用户今天是否已经签到
        $today_is_sign = App_Sign::is_sign($uid, date('Y-m-d'));
        
        $userinfo =  $this->_user->getUserInfo();
        $levelinfo = App_Level::get_Level_info($userinfo['userLevel']);
        
        //获取签到记录
        $sign_list = App_Sign::get_sign_list($uid);
        //获取用户最近一段时间内的签到记录
        $sign_continuity_list = App_Sign::get_continuity_sign_list($uid);
        
//        var_dump($sign_list);
//        var_dump($sign_continuity_list);exit;

        $this->template->set('sign_list', $sign_list);
        $this->template->set('sign_continuity_list', $sign_continuity_list);
        
        $this->template->set('levelinfo', $levelinfo);
        $this->template->set('userinfo', $userinfo);
        $this->template->set('today_is_sign', $today_is_sign);
        $this->template->set('total_count', $total_count);
        $this->template->set('continuity_count', $continuity_count);
        $this->template->set_filename('smarty:app/test/signlist');
        
        
    }
    
    
    public function action_handle_sign()
    {
        $uid = $this->_uid;
        App_Sign::handle_sign($uid);
    }

}
